// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Author: wsfuyibing <682805@qq.com>
// Date: 2024-12-02

package list

import (
	"gitee.com/go-libs/db-xorm/db"
	"gitee.com/gomq/sr"
	"gomq/app"
)

type Response struct {
	Id         int          `json:"id"`
	Status     app.Status   `json:"status"`
	StatusText string       `json:"status_text"`
	Topic      sr.TopicName `json:"topic"`
	Tag        sr.TopicTag  `json:"tag"`

	Concurrency  int32      `xorm:"concurrency" json:"concurrency"`
	DelaySeconds int        `xorm:"delay_seconds" json:"delay_seconds"`
	Threads      int        `xorm:"threads" json:"threads"`
	MaxRetry     int        `xorm:"max_retry" json:"max_retry"`
	Store        app.Status `xorm:"store" json:"store"`

	Title  string `xorm:"title" json:"title"`
	Remark string `xorm:"remark" json:"remark"`

	ConditionFormat           sr.Format     `xorm:"condition_format" json:"condition_format"`
	ConditionExpression       sr.Expression `xorm:"condition_expression" json:"condition_expression"`
	Handler                   sr.Address    `xorm:"handler" json:"handler"`
	HandlerTimeout            int           `xorm:"handler_timeout" json:"handler_timeout"`
	HandlerMethod             sr.Method     `xorm:"handler_method" json:"handler_method"`
	HandlerFormat             sr.Format     `xorm:"handler_format" json:"handler_format"`
	HandlerResponseFormat     sr.Format     `xorm:"handler_response_format" json:"handler_response_format"`
	HandlerResponseExpression sr.Expression `xorm:"handler_response_expression" json:"handler_response_expression"`

	Failed                   sr.Address    `xorm:"failed" json:"failed"`
	FailedTimeout            int           `xorm:"failed_timeout" json:"failed_timeout"`
	FailedMethod             sr.Method     `xorm:"failed_method" json:"failed_method"`
	FailedFormat             sr.Format     `xorm:"failed_format" json:"failed_format"`
	FailedResponseFormat     sr.Format     `xorm:"failed_response_format" json:"failed_response_format"`
	FailedResponseExpression sr.Expression `xorm:"failed_response_expression" json:"failed_response_expression"`

	Succeed                   sr.Address    `xorm:"succeed" json:"succeed"`
	SucceedTimeout            int           `xorm:"succeed_timeout" json:"succeed_timeout"`
	SucceedMethod             sr.Method     `xorm:"succeed_method" json:"succeed_method"`
	SucceedFormat             sr.Format     `xorm:"succeed_format" json:"succeed_format"`
	SucceedResponseFormat     sr.Format     `xorm:"succeed_response_format" json:"succeed_response_format"`
	SucceedResponseExpression sr.Expression `xorm:"succeed_response_expression" json:"succeed_response_expression"`

	CreatedAt db.Datetime `xorm:"created_at" json:"created_at"`
	UpdatedAt db.Datetime `xorm:"updated_at" json:"updated_at"`
}
